

#ifndef _ucuiEdit_h
#define _ucuiEdit_h
#pragma pack (push, 8)

#if _MSC_VER >= 1000
#pragma once
#endif 

#define UC_ES_STRING                        0x01	
#define	UC_ES_SYMBOL                        0x02
#define UC_ES_NUMERIC                       0x04
#define UC_ES_ANGLE                         0x08

#define UC_ES_VAL_ONKILLFOCUS               0x10
#define UC_ES_CONV_ONKILLFOCUS              0x20
#define UC_ES_SHOW_ERRMSG                   0x40
#define UC_ES_ERRMSG_ALLOWIGNORE            0x80

#define UC_ES_NOZERO                        0x100
#define UC_ES_NOBLANK                       0x200	
#define UC_ES_NONEGATIVE                    0x400
#define	UC_ES_INRANGE                       0x800

typedef enum {
    kUcUiError_None,                    
    kUcUiError_Blank,                   
    kUcUiError_Symbol,                  
    kUcUiError_Numeric,                 
    kUcUiError_Angle,                   
    kUcUiError_Zero,                    
    kUcUiError_Negative,                
    kUcUiError_Range                    
} UCUI_ERROR_CODE;

class UCUI_PORT CUcUiEdit : public CZdUiEdit {
    DECLARE_DYNAMIC(CUcUiEdit)

public:
                CUcUiEdit ();
virtual         ~CUcUiEdit ();

private:
        BOOL    m_bWantsFocus;
        BOOL    m_bWasValid;

protected:
virtual UDUI_REPLY DoZdUiMessage (
                    UDUI_NOTIFY notifyCode, UINT controlId, LPARAM lParam
                );

public:
virtual void    SetStyleMask (DWORD mask);

private:
        void    DisplayError (UINT);    
public:
        BOOL    m_bChanged;             
        double  m_dMinValue;           
        double  m_dMaxValue;           
        CString m_csMsg;                
        BOOL    m_bTouch;               

        void    Convert ();             
        BOOL    ConvertData (CString& x);
        BOOL    HasChanged ();          
        void    SetDirty ();
        void    SetRange (double vMin, double vMax);
        BOOL    Validate ();			
        UCUI_ERROR_CODE ValidateData (CString& x);

public:

protected:
	
	afx_msg BOOL OnChange();
    afx_msg void OnErrSpace();
    afx_msg void OnKillFocus(CWnd* pNewWnd);

	DECLARE_MESSAGE_MAP()
};

class UCUI_PORT CUcUiAngleEdit : public CUcUiEdit {
    DECLARE_DYNAMIC(CUcUiAngleEdit)

public:
                CUcUiAngleEdit ();
virtual         ~CUcUiAngleEdit ();

public:
virtual void    SetStyleMask (DWORD mask);

public:

protected:

	DECLARE_MESSAGE_MAP()
};

class UCUI_PORT CUcUiNumericEdit : public CUcUiEdit {
    DECLARE_DYNAMIC(CUcUiNumericEdit)

public:
                CUcUiNumericEdit ();
virtual         ~CUcUiNumericEdit ();

public:
virtual void    SetStyleMask (DWORD mask);

public:

protected:

	DECLARE_MESSAGE_MAP()
};

class UCUI_PORT CUcUiStringEdit : public CUcUiEdit {
    DECLARE_DYNAMIC(CUcUiStringEdit)

public:
	            CUcUiStringEdit ();
virtual         ~CUcUiStringEdit ();

public:
virtual void    SetStyleMask (DWORD mask);

public:

protected:

	DECLARE_MESSAGE_MAP()
};

class UCUI_PORT CUcUiSymbolEdit : public CUcUiEdit {
    DECLARE_DYNAMIC(CUcUiSymbolEdit)

public:
                CUcUiSymbolEdit ();
virtual         ~CUcUiSymbolEdit ();

public:
virtual void    SetStyleMask (DWORD mask);

public:

protected:

	DECLARE_MESSAGE_MAP()
};

#pragma pack (pop)
#endif


